package com.jasic.common;

/**
 * User: Jasic
 * Date: 12-12-24
 */
public class GlobalConstant {

    public static byte HEADER = 0x7e;
    // HEADR的长度
    public static int HEADER_LENGTH = 1;

    // 数据包中表示包长度的实际比特长度
    public static int LENGTH_LENGTH = 1;

    public static byte TAIL = 0x7e;

    /********************************************************************************************
     * 包头和包尾：采用 0x7e 表示，若校验码、消息头以及消息体中出现 0x7e，则要进行转义处理。转义处理定义如下：
     *      0x7e ←→ 0x7d 后紧跟一个 0x02；
     *      0x7d ←→ 0x7d 后紧跟一个 0x01。
     ********************************************************************************************/

    public static byte ADD_CONNTDN_0x7e =0x7e;
    public static byte ADD_CONNTDN_0x7d =0x7d;

    public static byte ADD_CONNTDN_0x7e_0x02 =0x02;
    public static byte ADD_CONNTDN_0x7d_0x01 =0x01;


    public static final byte BUSINESS_SERVER = 0x01;
    public static final byte PROTOCOL_SERVER = 0x00;

    public static final byte LOGIN_PASSWORD_LENGTH = 16;
    public static final byte LOGIN_LENGTH = 31;

    public static final byte CMD_LOGIN = 1;
    public static final byte LOGIN_USERNAME_LENGTH = 8;
    public static final byte LOGINRESP_CODE_SUCCESS = 0;
    public static final byte LOGINRESP_CODE_UNSUCCESS = 1;


    //0xff=1111,1111 = -1
    public static final byte CMD_LOGINRESP = -1;
    public static final byte LOGINRESP_LENGTH = 8;

    //0x02 = 2;
    public static final byte CMD_LOGOUT = 2;
    public static final byte LOGOUT_LENGTH = 7;

    // 0x03 =3;
    public static final byte CMD_POSTION = 3;
    public static final byte POSTION_LENGTH = 16;
    public static final byte POSTION_TARGET_ID_LENGTH = 8;


    // 0xfd
    public static final byte CMD_POSTIONRESP = -3 ;
    public static final byte POSTIONRESP_LENGTH = 44;
    public static final byte POSTIONRESP_MSG_LENGTH = 37;
    public static final byte POSTIONRESP_RESULT_SUCCESS = 0;
    public static final byte POSTIONRESP_RESULT_UNSUCCESS = -1;

}
